package util;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Msg {

	
	/**
     * DateFormat used in every method of this class in order to print the timestamp in a legible way.
     */
    private static DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd hh:mm:ss:SSS z" );


    /**
     * Prints a message in the standard output. It adds to the message the tag "LOG:" and a timestamp before printing it.
     * 
     * @param msg Message to be printed
     */
    public static void log( String msg ) {

            System.out.println( "LOG: \t" + dateFormat.format( Calendar.getInstance().getTime() ) + "\t" + msg );
    }


    /**
     * Prints a message in the standard output. It adds to the message the tag "DEFAULT:" and a timestamp before printing it.
     * 
     * @param msg Message to be printed
     */
    public static void debug( String msg ) {

            System.out.println( "DEBUG: \t" + dateFormat.format( Calendar.getInstance().getTime() ) + "\t" + msg );
    }


    /**
     * Prints a message in the error output. It adds to the message the tag "ERROR:" and a timestamp before printing it.
     * 
     * @param msg Message to be printed
     */
    public static void error( String msg ) {

            System.err.println( "ERROR: \t" + dateFormat.format( Calendar.getInstance().getTime() ) + "\t" + msg );
    }
	
}
